package sfmc.common.util;

public class CastUtil {

	public static String toStr(int arg) {return Integer.toString(arg); }

	public static String toStr(long arg) { return Long.toString(arg); }

	public static String toStr(double arg) { return Double.toString(arg); }

	public static int toInt(long arg) { return new Long(arg).intValue(); }

	public static int toInt(double arg) { return new Double(arg).intValue(); }

	public static int toInt(String arg) { return new Integer(arg.trim()).intValue(); }

	public static int toInt(Object arg) { return ((Double)arg).intValue(); }

	public static double toDbl(String arg) { return new Double(arg.trim()).doubleValue(); }
	
	public static int intValue(String intStr, int initValue) {
		int retInt = initValue;
		try {
			if (intStr != null && intStr.trim().length() > 0) {
				retInt = Integer.parseInt(intStr.trim());	
			}
		} catch (NumberFormatException e) {}
		return retInt;
	}
}
